package com.dfk.bs.service.user.impl;


import com.aliyuncs.exceptions.ClientException;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dfk.bs.common.aliyun.AliyunConfig;
import com.dfk.bs.dao.user.MessageMapper;
import com.dfk.bs.entity.vo.Message;
import com.dfk.bs.service.user.MessageService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements MessageService {


    @Override
    public void pageQuery(Page<Message> pageParam, String selectname) {

    }

    /**
     * @Function: 短信验证
     * @author:   Yangxf
     * @Date:     2019/4/11 15:56
     * @param:    phone 手机号
     */
    @Override
    public Map<String, Object> SmsVerification(String phone) {
        Map<String, Object> map = new HashMap<>();
        try {
            AliyunConfig.sendSms(phone);
            map.put("code", 200);
            map.put("msg", "短信验证发送成功");
            return map;
        } catch (ClientException e) {
            map.put("code", 300);
            map.put("msg", e.getMessage());
            return map;
        }
    }
}
